package cn.bjc.org.domain;

import cn.bjc.basic.domain.BaseDomain;
import com.fasterxml.jackson.annotation.JsonInclude;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.ArrayList;
import java.util.List;

/**
 * 部门
 */
@Data   //包含get,set,toString
@AllArgsConstructor //有参构造
@NoArgsConstructor  //无参构造
public class Department extends BaseDomain {
    
    //部门编号
    private String sn;
    
    //部门名字
    private String name;
    
    //上级部门路径
    private String dirPath;
   
    //部门状态(是否启用这个部门:1:启用/0:禁用)
    private String state;
    
    //管理者id(部门领导),外键连接到employee
    private Long manager_id;
    
    //employee对象:领导:manager_id
    private Employee manager;
    
    
    //上级部门的id(为空就是顶级部门)
    private Long parent_id;
    private Department parent;

    //用于封装当前部门的子部门
    //部门树最后一级没有数据就不显示
    @JsonInclude(JsonInclude.Include.NON_EMPTY)
    List<Department> children = new ArrayList<>();
    
}
